use clap::Parser;
use nacos_console::{Cli, ConsoleExecutor};
use tracing::{info, error};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    // 初始化日志
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::INFO)
        .init();

    info!("🎯 Nacos Console Starting...");

    // 解析命令行参数
    let cli = Cli::parse();

    // 执行命令
    if let Err(e) = ConsoleExecutor::execute(cli).await {
        error!("❌ Console execution failed: {}", e);
        return Err(e);
    }

    info!("✅ Console execution completed");
    Ok(())
}